<?php require_once("../includes/functions.php"); ?>
<?php
include('ZCreditResponseData.php');
/*
// Get the data by ZCreditResponseData object
$ResponseData = new ZCreditResponseData();
$ResponseData->GUID = $_REQUEST["GUID"];
$ResponseData->ID = $_REQUEST["ID"];
$ResponseData->Sum = floatval($_REQUEST["Sum"]);
$ResponseData->Currency = $_REQUEST["Currency"];
$ResponseData->Payments = $_REQUEST["Payments"];
$ResponseData->CardNum = $_REQUEST["CardNum"];
$ResponseData->CardName = $_REQUEST["CardName"];
$ResponseData->UniqueID = $_REQUEST["UniqueID"];
$ResponseData->Token = $_REQUEST["Token"];
$ResponseData->ApprovalNumber = $_REQUEST["ApprovalNumber"];
$ResponseData->CustomerName = $_REQUEST["CustomerName"];
$ResponseData->CustomerID = $_REQUEST["CustomerID"];
$ResponseData->CustomerPhone = $_REQUEST["CustomerPhone"];
$ResponseData->CustomerEmail = $_REQUEST["CustomerEmail"];
$ResponseData->CustomerExtraData = $_REQUEST["CustomerExtraData"];
*/
// Or get the data to variables
//$GUID = $_REQUEST["GUID"];
//$ID = $_REQUEST["ID"];
//$Sum = floatval($_REQUEST["Sum"]);
//$Currency = $_REQUEST["Currency"];
//$Payments = $_REQUEST["Payments"];
//$CardNum = $_REQUEST["CardNum"];
//$CardName = $_REQUEST["CardName"];
//$UniqueID = $_REQUEST["UniqueID"];
//$Token = $_REQUEST["Token"];
//$ApprovalNumber = $_REQUEST["ApprovalNumber"];
//$CustomerName = $_REQUEST["CustomerName"];
//$CustomerID = $_REQUEST["CustomerID"];
//$CustomerPhone = $_REQUEST["CustomerPhone"];
//$CustomerEmail = $_REQUEST["CustomerEmail"];
//$CustomerExtraData = $_REQUEST["CustomerExtraData"];
//---------------------

$GUID = ( isset($_REQUEST["GUID"]) ? $_REQUEST["GUID"] : "");
$ID = ( isset($_REQUEST["ID"]) ? $_REQUEST["ID"] : "");
$Sum = ( isset($_REQUEST["Sum"]) ? $_REQUEST["Sum"] : "");
$Currency = ( isset($_REQUEST["Currency"]) ? $_REQUEST["Currency"] : "");
$Payments = ( isset($_REQUEST["Payments"]) ? $_REQUEST["Payments"] : "");
$CardNum = ( isset($_REQUEST["CardNum"]) ? $_REQUEST["CardNum"] : "");
$CardName = ( isset($_REQUEST["CardName"]) ? $_REQUEST["CardName"] : "");
$UniqueID = ( isset($_REQUEST["UniqueID"]) ? $_REQUEST["UniqueID"] : "");
$Token = ( isset($_REQUEST["Token"]) ? $_REQUEST["Token"] : "");
$ApprovalNumber = ( isset($_REQUEST["ApprovalNumber"]) ? $_REQUEST["ApprovalNumber"] : "");
$CustomerName = ( isset($_REQUEST["CustomerName"]) ? $_REQUEST["CustomerName"] : "");
$CustomerID = ( isset($_REQUEST["CustomerID"]) ? $_REQUEST["CustomerID"] : "");
$CustomerPhone = ( isset($_REQUEST["CustomerPhone"]) ? $_REQUEST["CustomerPhone"] : "");
$CustomerEmail = ( isset($_REQUEST["CustomerEmail"]) ? $_REQUEST["CustomerEmail"] : "");
$CustomerExtraData = ( isset($_REQUEST["CustomerExtraData"]) ? $_REQUEST["CustomerExtraData"] : "");

$manuyDetails  = explode("A", $UniqueID);

$manuy_row = $manuyDetails[0];
$manuy_number = $manuyDetails[1];


if (isset($_REQUEST["UniqueID"]))
{
		require("../includes/openConnection.php"); 
                $today=date("Y-m-d");
                $lastPayment = date('Y-m-d', strtotime("+".$Payments." months", strtotime($today)));
                if(mysql_query("UPDATE  manuy2client SET  `shulam` =  '1' WHERE  manuy_row ='{$UniqueID}';"))
         
		if(mysql_query("INSERT INTO slikot (`slikot_row`,`create`, `GUID`, `ID`, `Sum`, `Currency`, `Payments`, `CardNum`, `CardName`, `UniqueID`, `Token`, `ApprovalNumber`, `CustomerName`, `CustomerID`, `CustomerPhone`, `CustomerEmail`, `CustomerExtraData`, `manuy_row`, `manuy_number`, `last_Payment_In`) VALUES 
                                                     (NULL, '{$today}', '{$GUID}', '{$ID}', '{$Sum}', '{$Currency}', '{$Payments}', '{$CardNum}', '{$CardName}', '{$UniqueID}', '{$Token}', '{$ApprovalNumber}', '{$CustomerName}', '{$CustomerID}', '{$CustomerPhone}', '{$CustomerEmail}', '{$CustomerExtraData}', '{$manuy_row}', '{$manuy_number}', '{$lastPayment}');")) 
                {
                echo "תודה על סליקתך. תרענן את הדף ותראה את השינוי";
                setAmlaDate($manuy_number);
                }
                else echo mysql_error();
		require("../includes/closeConnection.php");
}




?>